package other;

import java.util.Arrays;
import java.util.Scanner;

public class asd {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int[] y = new int[num];  // 安全指数
        int[] rightNumArr = new int[num]; // 预测结果
        int[] result = new int[num]; // 实际结果
        for (int i = 0; i < num; i++) {
            String[] split = sc.nextLine().split(" ");
            y[i] = Integer.parseInt(split[0]);
            result[i] = Integer.parseInt(split[1]);
        }

        System.out.println(Arrays.toString(y));
        System.out.println(Arrays.toString(result));

        for (int i = 0; i < num; i++) {
            int threshold = y[i]; //设当前y_i为阈值
            int predict = 0; // 预测值
            int rightNum = 0;
            for (int j = 0; j < num; j++) {
                if (y[j] >= threshold) {
                    predict = 1;
                }
                if (predict == result[j]) {
                    rightNum++;
                }
            }
            rightNumArr[i] = rightNum;
        }

        System.out.println(Arrays.toString(rightNumArr));
    }


    void quickSort(int i) {

    }
}
